<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta content="telephone=no,email=no" name="format-detection">
<meta name="wap-font-scale" content="no">
<title>常用信息</title>
<!-- 公用样式css -->
<link rel="stylesheet" href="css/base.css"/>
<link rel="stylesheet" href="css/card-package.css"/>
<link rel="stylesheet" href="css/idangerous.swiper.css"/>
<link rel="stylesheet" href="css/interests-member.css"/>
<link rel="stylesheet" href="css/supplement.css"/>
<link rel="stylesheet" href="css/slide/slide.css"/>
    <style media="screen">
        * {margin: 0;padding: 0;}
        ul {list-style: none;}
        .sl-content {
            overflow: hidden;
        }
        .sl-content img {
            width: 120px;
            height: auto;
            margin-right: 8px;
            float: left;
        }
    </style>
</head>
<body ontouchstart>
<%-- <header class="header">
   <a href="<%=basePath%>/member/memberCenter" class="header-left"><img class="img-home" src="images/return.png" /></a>
    <div class="header-center word5 "><a class="header-arrow">常用信息</a></div>
</header> --%>
<div class="main" style="background:#fff;">
    <div class="tabs">
        <a href="<%=basePath%>member/getMemCheckInList" hidefocus="true" class="active">入住人</a>
        <a href="<%=basePath%>member/getMemInvoiceList" hidefocus="true">发票</a>
        <a href="<%=basePath%>member/getMemAddressList" hidefocus="true" >地址</a>
    </div>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <div class="common-tj">
                    <button class="button-rzr wor-colour6" onclick="_addInfo();return false;">添加入住人</button>
                </div>
                <ul class=" common-list3 ">
                <c:if test="${not empty dataList}">
                    <c:forEach var="person" items="${dataList}">
                        <li class="sl-li ui-border-b" style="border-bottom: 2px solid #eee;">
                            <div class="sl-content">
                                <p>${person.ContactName}</p>
                                <p>${person.ContactPhone}</p>
                                <c:if test="${person.DefaultSign}">
                                <div class="slDefaultDiv">
                                    <p class=" float-l common-button">默认</p>
                                </div>
                                </c:if>
                                <c:if test="${!person.DefaultSign}">
                                	<div class="slDefaultDiv">
                                    <div class="fit_box">
                                        <input type="hidden" id="defaultSign">
                                        <input type="radio" value="true" id="setDefault_${person.ID}" name="radio" onclick="_setDefault('${person.ID}');return false;">
                                        <label for="setDefault_${person.ID}"></label>
                                    </div>
                                    <span class="wor-colour8">设为默认</span>
                                    </div>
                                </c:if>
                            </div>
                            <div class="sl-opts">
                                <span style="background-color: #F95F61; color: #fff;" onclick="_deleteInfo(${person.ID});return false;">删除</span>
                                <span style="background-color: #ff9c00; color: #fff;" onclick="_modifyInfo('${person.ID}','${person.ContactName}','${person.ContactPhone}','${person.DefaultSign}');return false">修改</span>
                            </div>
                        </li>
                    </c:forEach>
                </c:if>
                <c:if test="${empty dataList}"> <img src="<%=basePath%>/images/icon38.png"></c:if>
                </ul>
            </div>
        </div>
    </div>
</div>

<script src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/idangerous.swiper.min.js"></script>
<script type="text/javascript" src="js/artDialog/artDialog.source.js?skin=simple"></script>
<script type="text/javascript" src="js/artDialog/plugins/iframeTools.source.js"></script>
<script type="text/javascript" src="js/slide/zepto.min.js"></script>
<script type="text/javascript" src="js/slide/slideleft.min.js"></script>

<script type="text/javascript">
    function _setDefault(id) {
        $.ajax({
            url:"<%=basePath%>member/setMemDefaultCheckInPeo",
            type:"post",
            data:{id:id},
            success:function(data){
                if(data.stateID==0&&data.businessState==0){
                    art.dialog.tips('操作成功');
                    window.location.replace('<%=basePath%>member/getMemCheckInList');
                }else if(data.stateID==4){
                    window.location.replace('<%=basePath%>home/gotoRegister');//注册页面
                }else {
                    art.dialog.tips(data.msgInfo);
                }
            },
            error:function(e){
                art.dialog.tips('操作异常');
                window.location.replace('<%=basePath%>member/getMemCheckInList');
            }
        });
    }

function _addInfo() {
    var url = "<%=basePath%>/member/gotoAddCheckInPeo";
    window.location.replace(url);
}

function  _deleteInfo(id) {
    $.ajax({
        url:"<%=basePath%>member/delCheckInPeo",
        type:"post",
        data:{id:id},
        success:function(data){
            if(data.stateID==0&&data.businessState==0){
                art.dialog.tips('操作成功');
                window.location.replace('<%=basePath%>member/getMemCheckInList');
            }else if(data.stateID==4){
                window.location.replace('<%=basePath%>home/gotoRegister ');//注册页面
            }else {
                art.dialog.tips(data.msgInfo);
            }
        },
        error:function(e){
            art.dialog.tips('操作异常');
            window.location.replace('<%=basePath%>member/getMemCheckInList');
        }
    });
}
function  _modifyInfo(id,contactName,contactPhone,defaultSign) {
    var url = "<%=basePath%>member/gotoModifyMemberCheckInfo?id="+id+"&contactName="+contactName+"&contactPhone="+contactPhone+"&defaultSign="+defaultSign;
    window.location.replace(url);
}

</script>
